﻿<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
  
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Migration from version 0.6.0 to 1.0.0 </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Migration from version 0.6.0 to 1.0.0 ">
    <meta name="generator" content="docfx 2.40.7.0">
    
    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">
    
    
    
  </head>
  <body data-spy="scroll" data-target="#affix" data-offset="120">
    <div id="wrapper">
      <header>
        
        <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              
              <a class="navbar-brand" href="../index.html">
                <img id="logo" class="svg" src="../logo.svg" alt="">
              </a>
            </div>
            <div class="collapse navbar-collapse" id="navbar">
              <form class="navbar-form navbar-right" role="search" id="search">
                <div class="form-group">
                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
                </div>
              </form>
            </div>
          </div>
        </nav>
        
        <div class="subnav navbar navbar-default">
          <div class="container hide-when-search" id="breadcrumb">
            <ul class="breadcrumb">
              <li></li>
            </ul>
          </div>
        </div>
      </header>
      <div role="main" class="container body-content hide-when-search">
        
        <div class="sidenav hide-when-search">
          <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
          <div class="sidetoggle collapse" id="sidetoggle">
            <div id="sidetoc"></div>
          </div>
        </div>
        <div class="article row grid-right">
          <div class="col-md-10">
            <article class="content wrap" id="_content" data-uid="">

<a href="https://github.com/NeutroniumCore/Neutronium" target="_blank">
  <img style="position: fixed; top: 0; right: 0; border: 0; z-index:99999" width="149" height="149" src="https://github.blog/wp-content/uploads/2008/12/forkme_right_gray_6d6d6d.png?resize=149%2C149" class="attachment-full size-full" alt="Fork me on GitHub" data-recalc-dims="1">
</a>
<h1 id="migration-from-version-060-to-100">Migration from version 0.6.0 to 1.0.0</h1>
<h2 id="breaking-changes">Breaking changes</h2>
<h3 id="c-changes">C# changes</h3>
<ul>
<li><p><code>ISimpleCommand</code> signature changed. You should migrate to wether <code>ISimpleCommand&lt;T&gt;</code> or <code>ISimpleCommand</code> is no argument needs to be passed. Complete details <a href="../binding/mvvm-components.html">here</a></p>
</li>
<li><p><code>IHTMLBinding</code> has been renamed <code>IHtmlBinding</code></p>
</li>
<li><p>Updates on the ViewModel should now happen on the UI thread, since Neutronium is not redirecting them anymore.<br>
Practically, this means that you should ensure that any <code>INotifyPropertyChanged</code> events and ObservableCollection updates occurs on the UI threads:
you can use <a href="https://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher(v=vs.110).aspx">WPF Dispatcher</a> <code>Invoke</code> or <code>BeginInvoke</code> methods.<br>
Neutronium ALWAYS will call ViewModel on the UI thread either when updating properties value or executing command.</p>
</li>
</ul>
<h3 id="vue-scripts">Vue scripts</h3>
<ul>
<li>Using vue mixins
If you were using manual, registration, change:</li>
</ul>
<pre><code>Vue._vmMixin = [localMixin];
</code></pre>
<p>For:</p>
<pre><code>window.glueHelper.setOption({mixins : [localMixin]});
</code></pre>
<p>Even better you can use <code>install.js</code> file to register mixin if using <a href=".../tools/vue-cli-plugin.html#installjs-file">neutronium-vue template</a>.</p>
<h3 id="viewmodel-binding">ViewModel binding</h3>
<p>Starting from version 1.0.0, Neutronium is converting main ViewModel and window viewModel to an object:</p>
<pre><code class="lang-javascript">{
    ViewModel,
    __window__
}
</code></pre>
<p>This has no impact if you are using <code>neutronium-vue</code> from scratch as new template take this into account.</p>
<p>If you are using <code>knockout</code>, you may using <code>with</code> binding around application mark-up to set-up the context to <code>ViewModel</code>:</p>
<pre><code class="lang-HTML">&lt;!-- ko with:$data.ViewModel()--&gt;
    &lt;!--application--&gt;

&lt;!--/ko--&gt;
</code></pre>
<p>Next section describes how to update project created in version v0.6.0 using <code>neutronium-vue</code>.</p>
<h3 id="template-created-from-neutronium-vue">Template created from <code>neutronium-vue</code></h3>
<p>Update dependencies version:</p>
<pre><code>&quot;vue&quot;: &quot;^2.5.2&quot;,
&quot;vue-loader&quot;: &quot;^13.3.0&quot;,
&quot;vue-style-loader&quot;: &quot;^3.0.3&quot;,
&quot;vue-template-compiler&quot;: &quot;^2.5.0&quot;
</code></pre>
<p>Adjust the following files:</p>
<ul>
<li><code>index.html</code> (two files, both under root and in the <code>.\dist</code> folder)</li>
</ul>
<p>Change</p>
<pre><code class="lang-HTML">&lt;App :view-model=&quot;$data&quot;&gt;
&lt;/App&gt;
</code></pre>
<p>To:</p>
<pre><code class="lang-HTML">&lt;App :view-model=&quot;$data.ViewModel&quot; :__window__=&quot;$data.Window&quot;&gt;
&lt;/App&gt;
</code></pre>
<ul>
<li><code>App.vue</code></li>
</ul>
<p>Change</p>
<pre><code class="lang-javascript">const props  ={
    viewModel: Object,
};
</code></pre>
<p>To:</p>
<pre><code class="lang-javascript">const props={
    viewModel: Object,
    __window__: Object
};
</code></pre>
<ul>
<li><code>main.js</code></li>
</ul>
<p>Change</p>
<pre><code class="lang-javascript">const vm = CircularJson.parse(rawVm);
</code></pre>
<p>To:</p>
<pre><code class="lang-javascript">function updateVm(vm) {
    var window = vm.__window__
    if (window) {
         delete vm.__window__
        return { ViewModel: vm, Window: window }
    }
    return vm;
}
const vm = updateVm(CircularJson.parse(rawVm));
</code></pre>
</article>
          </div>
          
          <div class="hidden-sm col-md-2" role="complementary">
            <div class="sideaffix">
              <div class="contribution">
                <ul class="nav">
                  <li>
                    <a href="https://github.com/NeutroniumCore/Neutronium/blob/master/Documentation/Neutronium.Documentation/versions/migrate1.0.md/#L1" class="contribution-link">Improve this Doc</a>
                  </li>
                </ul>
              </div>
              <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
              <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
              </nav>
            </div>
          </div>
        </div>
      </div>
      
      <footer>
        <div class="grad-bottom"></div>
        <div class="footer">
          <div class="container">
            <span class="pull-right">
              <a href="#top">Back to top</a>
            </span>
            
            <span>Generated by <strong>DocFX</strong></span>
          </div>
        </div>
      </footer>
    </div>
    
    <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
    <script type="text/javascript" src="../styles/docfx.js"></script>
    <script type="text/javascript" src="../styles/main.js"></script>
  </body>
</html>
